#pragma once

#include <WiFi.h>
#include <ArduinoJson.h>
#include "Listenable.h"
#include "SocketEvent.h"
#include "SocketAcceptTask.h"
#include "EventLoopService.h"

class SocketService : public Listenable
{
private:
	WiFiClient* client;
	StaticJsonBuffer<1024> jsonBuffer;
	JsonObject& jsonData = jsonBuffer.createObject();
	void test();
public:
	SocketService() {};
	void init(WiFiClient* client);
	void accept();
	void send(SocketEvent& evt);
	~SocketService() {};
};

extern SocketService socketService;